package com.example.estest.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <一句话描述功能>
 * <详细功能描述>
 *
 * @author: fei
 * @date: 2020/10/17
 */
@RestController("/kafka")
public class KafkaSendController {
    @Autowired
    private KafkaTemplate<String,Object> kafkaTemplate;

    @GetMapping("/send")
    public String kafkaSend() {
        while (true) {
            kafkaTemplate.send("demo", "hello world!");
        }
    }
}
